var ds_receiver_manuscript = new Ext.data.Store({
			proxy : new Ext.data.HttpProxy({
						url : 'receiver_Manuscript_list.action',
						method : 'POST'
					}),
			reader : new Ext.data.JsonReader({
						root : 'manuscripts',
						totalProperty : 'totalCount'
					}, [{
								name : 'manuscriptId',
								mapping : 'manuscriptId',
								type : 'long'
							}, {
								name : 'contributeCompanyName',
								mapping : 'contributeCompany.contributeCompanyName',
								type : 'string'
							}, {
								name : 'manuscriptCategoryName',
								mapping : 'manuscriptCategory.manuscriptCategoryName',
								type : 'string'
							}, {
								name : 'title',
								mapping : 'title',
								type : 'string'
							}, {
								name : 'plannedConsummationTime',
								mapping : 'plannedConsummationTime',
								type : 'long'
							}, {
								name : 'urgence',
								mapping : 'urgence',
								type : 'short'
							}, {
								name : 'securityClassification',
								mapping : 'securityClassification',
								type : 'short'
							}, {
								name : 'operation',
								type : 'string'
							},{
								name : 'status',
								mapping : 'status',
								type : 'short'
							},{
								name : 'type',
								mapping : 'type',
								type : 'short'
							}])
		});

var contributeCompanyList = new Ext.data.JsonStore({
			url : 'contributeCompany_active_list.action',
			root : 'contributeCompanys',
			fields : ['contributeCompanyId', 'contributeCompanyName']
		});

contributeCompanyList.load();

var manuscriptCategoryList = new Ext.data.JsonStore({
			url : 'manuscriptCategory_list.action',
			root : 'manuscriptCategorys',
			fields : ['manuscriptCategoryId', 'manuscriptCategoryName']
		});

manuscriptCategoryList.load();

var ccontributeCompanyId=0;
var contributeCompanyPersonList = new Ext.data.JsonStore({
			url : 'contributeCompanyPerson_active_list.action',
			root : 'contributeCompanyPersons',
			baseParams:{contributeCompanyId:ccontributeCompanyId},
			fields : ['contributeCompanyPersonId', 'name']
		});


function totime(value, metadata, record) {
	return new Date(value).format('Y-m-d H:i');
}

function tourgence(value) {
	switch (value) {
		case 0 :
			return "普通";
			break;
		case 5 :
			return "紧急";
			break;
		case 10 :
			return "特急";
			break;
	}
}

function tosecurityClassification(value) {
	switch (value) {
		case 1 :
			return "普通";
			break;
		case 2 :
			return "秘密";
			break;
		case 3 :
			return "机密";
			break;
		case 5 :
			return "绝密";
			break;
	}
}

function toSecurityGrade(value) {
	switch (value) {
		case 1 :
			return "普通";
			break;
		case 2 :
			return "秘密";
			break;
		case 3 :
			return "机密";
			break;
		case 5 :
			return "绝密";
			break;
	}
}

function tolanguage(value) {
	switch (value) {
		case 1 :
			return "汉语";
			break;
		case 2 :
			return "藏语";
			break;
	}
}

function totargetLanguage(value) {
	switch (value) {
		case 1 :
			return "汉语";
			break;
		case 2 :
			return "藏语";
			break;
	}
}

function totexttype(value) {
	switch (value) {
		case 0 :
			return "纸质稿件";
			break;
		case 0x0100 :
			return "电子稿件";
			break;
	}
}

function totype(value) {
	if(value=="DW"){
		return "党委";
	}else if(value=="RD"){
		return "人大";
	}else if(value=="ZF"){
		return "政府";
	}else if(value=="ZX"){
		return "政协";
	}else if(value=="QT"){
		return "其他";
	}else{
		return value;
	}
}

var urgence;
var securityClassification;
var language;
var targetLanguage;
var contributeTime;
var plannedConsummationTime;
var type;
var texttype;
function formchange(respText) {
	urgence = tourgence(respText.manuscript.urgence);
	securityClassification = tosecurityClassification(respText.manuscript.securityClassification);
	language = tolanguage(respText.manuscript.language);
	targetLanguage = totargetLanguage(respText.manuscript.targetLanguage);
	contributeTime = totime(respText.manuscript.contributeTime, "", "");
	plannedConsummationTime = totime(
			respText.manuscript.plannedConsummationTime, "", "");
	texttype = totexttype(respText.manuscript.type);
	type = totype(respText.manuscript.contributeCompany.type);
}

var re;
function tomark(value, metadata, record) {
    var title = '&nbsp;密级&nbsp;&nbsp;&nbsp;&nbsp;紧急程度&nbsp;';
    var tip;
    var s1 = "&nbsp;普通&nbsp;&nbsp;&nbsp;&nbsp;";
    var s2 = "&nbsp;秘密&nbsp;&nbsp;&nbsp;&nbsp;";
    var s3 = "&nbsp;机密&nbsp;&nbsp;&nbsp;&nbsp;";
    var s5 = "&nbsp;绝密&nbsp;&nbsp;&nbsp;&nbsp;";
    var u0 = "&nbsp;&nbsp;&nbsp;普通&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    var u5 = "&nbsp;&nbsp;&nbsp;紧急&nbsp;&nbsp;&nbsp;&nbsp;";
    var u10 = "&nbsp;&nbsp;&nbsp;特急";
    var c0 = "&nbsp<img src='images/clock_blue.gif'  />&nbsp";// 普通urgence
    var c5 = "&nbsp<img src='images/clock_green.gif' />&nbsp";// 紧急
    var c10 = "&nbsp<img src='images/clock_red.gif' />&nbsp";// 特急
    var l1 = "&nbsp<img src='images/lock_blue.gif'  />&nbsp";// 普通securityClassification
    var l2 = "&nbsp<img src='images/lock_gold.gif'/>&nbsp"; // 秘密
    var l3 = "&nbsp<img src='images/lock_green.gif' />&nbsp";// 机密
    var l5 = "&nbsp<img src='images/lock_red.gif'  />&nbsp";// 绝密
    switch (record.data.securityClassification) {
        case 1:
            switch (record.data.urgence) {
                case 0:
                	re = l1 + c0;
                    tip = s1 + u0;
                    break;
                case 5:
                	re = l1 + c5 ;
                    tip = s1 + u5;
                    break;
                case 10:
                	re = l1 + c10;
                    tip = s1 + u10;
                    break;
            }
            break;
        case 2:
            switch (record.data.urgence) {
                case 0:
                	re = l2 + c0;
                    tip = s2 + u0;
                    break;
                case 5:
                	re = l2 + c5;
                    tip = s2 + u5;
                    break;
                case 10:
                	re = l2 + c10;
                    tip = s2 + u10;
                    break;
            }
            break;
        case 3:
            switch (record.data.urgence) {
	            case 0:
	            	re = l3 + c0;
	                tip = s3 + u0;
	                break;
	            case 5:
	            	re = l3 + c5;
	                tip = s3 + u5;
	                break;
	            case 10:
	            	re = l3 + c10;
	                tip = s3 + u10;
	                break;
            }
            
            break;
        case 5:
            switch (record.data.urgence) {
	            case 0:
	            	re = l5 + c0;
	                tip = s5 + u0;
	                break;
	            case 5:
	            	re = l5 + c5;
	                tip = s5 + u5;
	                break;
	            case 10:
	            	re = l5 + c10;
	                tip = s5 + u10;
	                break;
	            }
            break;
    }
    metadata.attr = 'ext:qtitle="' + title + '"' + ' ext:qtip="' + tip + '"';
    return re;
}
window.showManuscript = function(needParam) {
	Ext.Ajax.request({
		url : 'receiver_manuscriptInfo_view.action',
		method : 'post',
		params : {
			manuscriptId : needParam
		},
		success : function(resp, opts) {
			var respText = Ext.util.JSON.decode(resp.responseText);
			if (respText.success) {
				formchange(respText);
				var mywindow = new Ext.Window({
					title : '稿件详情',
					width : 600,
					iconCls:'manuscript',
					resizable : false,
					constrain: true,
					closable : false,
					autoHeight : true,
					modal : true,
					closeAction : 'hide',
					items : [new Ext.FormPanel({
						border : false,
						labelAlign : 'right',
						plain : true,
						labelWidth : 100,
						frame : true,
						items : [{
								fieldLabel : '稿件标题',
								xtype : 'textfield',
								readOnly : true,
								value : respText.manuscript.title,
								width : 426,
								itemCls : "unedit form_long"
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '稿件编号',
								readOnly : true,
								value : respText.manuscript.manuscriptCode,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '来稿单位',
								readOnly : true,
								value : respText.manuscript.contributeCompany.contributeCompanyName,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '来稿单位类型',
								readOnly : true,
								value : type,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '来稿人',
								readOnly : true,
								value : respText.manuscript.contributeCompanyPerson.name,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '联系人手机',
								readOnly : true,
								value : respText.manuscript.contributeCompanyPerson.mobilePhone,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '联系人邮箱',
								readOnly : true,
								value : respText.manuscript.contributeCompanyPerson.email,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '稿件分类',
								readOnly : true,
								value : respText.manuscript.manuscriptCategory.manuscriptCategoryName,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '紧急程度',
								readOnly : true,
								value : urgence,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '文档类型',
								readOnly : true,
								value : texttype,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '原稿文种',
								readOnly : true,
								value : language,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '密级',
								readOnly : true,
								value : securityClassification,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '目标语言',
								readOnly : true,
								value : targetLanguage,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '字数',
								readOnly : true,
								maxLength: 9,
								value : respText.manuscript.wordNum,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '来稿时间',
								readOnly : true,
								value : contributeTime,
								itemCls:'form_text unedit'
							}, {
								autoHeight : true,
								xtype : 'textfield',
								fieldLabel : '计划完成时间',
								readOnly : true,
								allowBlank: false,
								value : plannedConsummationTime,
								itemCls:'form_text unedit'
							},{
								autoHeight : true,
								xtype : 'textfield',
								itemCls : 'form_text unedit',
								fieldLabel : '创建人姓名',
								value : respText.manuscript.creatorName,
								readOnly : true
							}, {
								autoHeight : true,
								xtype : 'textfield',
								itemCls : 'form_text unedit',
								fieldLabel : '创建时间',
								value : totime(respText.manuscript.createdTimestamp,"",""),
								readOnly : true
							},{
								autoHeight : true,
								xtype : 'textfield',
								itemCls : 'form_text unedit',
								fieldLabel : '最后修改人',
								value : respText.manuscript.lastModifierName,
								readOnly : true
							}, {
								autoHeight : true,
								xtype : 'textfield',
								itemCls : 'form_text unedit',
								fieldLabel : '最后修改时间',
								value : totime(respText.manuscript.lastModifiedTimestamp,"",""),
								readOnly : true
							}, {
								fieldLabel : '备注',
				            	xtype: 'panel',
	                            width: 425,
	                            itemCls: 'clear',
								html: changeRemark(respText)
							}],
							buttons : [{
						     		text : '关闭',
						     		handler : function() {
										mywindow.hide();
									}
						     	}]
					})]
				}).show();
			} else {
				Ext.Msg.show({
							title : '错误提示',
							msg : respText.erroeMessage,
							buttons : Ext.Msg.OK,
							icon : Ext.Msg.ERROR,
							width : 200
						});
			}
		},
		failure : function() {
			Ext.Msg.show({
						title : '错误提示',
						msg : '加载失败!',
						buttons : Ext.Msg.OK,
						icon : Ext.Msg.ERROR,
						width : 200
					});
		}
	});
}

function changeRemark(respText){
	return "<div align=\"center\"><a href='javascript:void(0)'  onclick=javascript:showRemark('" + respText.manuscript.manuscriptId + "')>备注详情</a></div>";
}

window.showRemark = function(v){
    Ext.Ajax.request({
        url: 'receiver_manuscriptInfo_view.action',
        method: 'post',
        params: {
            manuscriptId: v
        },
        success: function(resp, opts){
            var respText = Ext.util.JSON.decode(resp.responseText);
            if (respText.success) {
                var window_remark = new Ext.Window({
                    title: '备注详情',
                    closable: false,
                    width: 600,
                    resizable: false,
                    height: 400,
                    iconCls: 'manuscript',
                    modal: true,
                    constrain: true,
                    closeAction: 'close',
                    layout: 'fit',
                    items: [{
                        xtype: 'htmleditor',
                        enableAlignments: false,
                        enableColors: false,
                        enableFont: false,
                        enableFontSize: false,
                        enableFormat: false,
                        enableLinks: false,
                        enableLists: false,
                        enableSourceEdit: false,
                        readOnly: true,
                        value: respText.manuscript.remark
                    }],
                    buttons: [{
                        text: '关闭',
                        handler: function(){
                            window_remark.close();
                        }
                    }]
                
                
                }).show();
            }
        },
        failure: function(){
            Ext.Msg.show({
                title: '错误提示',
                msg: '查看失败!',
                buttons: Ext.Msg.OK,
                icon: Ext.Msg.ERROR,
                width: 200
            });
        }
    })
}





window.modifyManuscript = function(needParam) {
	Ext.Ajax.request({
		url : 'receiver_showScript_view.action',
		method : 'post',
		params : {
			manuscriptId : needParam
		},
		success : function(resp, opts) {
			var respText = Ext.util.JSON.decode(resp.responseText);
			var manuscript = respText.manuscript;
			var contributeCompany = respText.manuscript.contributeCompany;
			var contributeCompanyPerson = respText.manuscript.contributeCompanyPerson;
			var manuscriptCategory = respText.manuscript.manuscriptCategory;
			if (respText.success) {
				manuscript_window = new Ext.Window({
					title : '修改稿件信息',
					width : 600,
					iconCls:'manuscript_edit',
					resizable : false,
					constrain: true,
					autoHeight : true,
					closable : false,
					modal : true,
					closeAction : 'hide',
					items : [modifyManuscriptForm = new Ext.FormPanel({
						frame : true,
						id : 'mmf',
						labelAlign : 'right',
						labelWidth : 95,
						defaultType : 'textfield',
						items : [{
									fieldLabel : '稿件标题',
									name : 'manuscript.title',
									value : manuscript.title,
									validator:function(value){
										if(value.length<=50){
											var result='',
											result= value.replace(/(^\s*)|(\s*$)/g, "");
											if(result==''){
												return false;
											}
											return true;
										}else{
											return false;
										}
									},
									invalidText:'标题不能为空且最大长度为50个字符',
									width : 426
								}, {
									xtype : 'combo',
									id:'contributeCompanyName',
									store : contributeCompanyList,
									fieldLabel : '来稿单位',
									value:contributeCompany.contributeCompanyName,
									editable : false,
									forceSelection : true,
									typeAhead : true,
									mode : 'local',
									triggerAction : 'all',
									hiddenName : 'contributeCompanyId',
									valueField : 'contributeCompanyId',
									displayField : 'contributeCompanyName',
									validator:function(){
										return true;
									} ,
									itemCls : 'form_text',
									listeners : {
										'valid':function(){
											if(contributeCompany.contributeCompanyName==Ext.getCmp('contributeCompanyName').getValue()){
													Ext.getCmp('contributeCompanyName').hiddenField.value = manuscript.contributeCompany.contributeCompanyId;
												}
											},
										'select' : function() {
											contributeCompanyPersonList.baseParams.contributeCompanyId= Ext.getCmp('contributeCompanyName').getValue();
											contributeCompanyPersonList.load();
											Ext.getCmp('contributeCompanyPerson_manuscript').setValue('');
											Ext.getCmp('contributeCompanyPerson_manuscript').allowBlank = false;
										},
							    		 "focus":function(){
							    		 	if(contributeCompanyList.getTotalCount() == 0){
							    		 		Ext.Msg.show({
															title : '操作提示',
															msg : '请管理员添加来稿单位!',
															buttons : Ext.Msg.OK,
															icon : Ext.Msg.INFO,
															width : 200
														});
							    		 	}
			    						 }
									}
								}, {
									xtype : 'combo',
									store : contributeCompanyPersonList,
									fieldLabel : '联系人',
									value:contributeCompanyPerson.name,
									editable : false,
									forceSelection : true,
									typeAhead : true,
									mode : 'local',
									triggerAction : 'all',
									id : 'contributeCompanyPerson_manuscript',
									hiddenName : 'contributeCompanyPersonId',
									valueField : 'contributeCompanyPersonId',
									displayField : 'name',
									validator:function(){
										return true;
									} ,
									itemCls : 'form_text',
									listeners:{
										'valid':function(){
												if(Ext.getCmp('contributeCompanyName').getValue()==manuscript.contributeCompany.contributeCompanyName){
													if(Ext.getCmp('contributeCompanyPerson_manuscript').getValue()==manuscript.contributeCompanyPerson.name){
															Ext.getCmp('contributeCompanyPerson_manuscript').hiddenField.value = manuscript.contributeCompanyPerson.contributeCompanyPersonId;
													}else{
														return;
													}
												}
											},
							    		 "focus":function(){
												if(Ext.getCmp('contributeCompanyName').getValue()==manuscript.contributeCompany.contributeCompanyName){
													contributeCompanyPersonList.baseParams.contributeCompanyId=manuscript.contributeCompany.contributeCompanyId;
													contributeCompanyPersonList.load();
												}else if(contributeCompanyPersonList.getTotalCount() == 0){
								    		 		Ext.Msg.show({
																title : '操作提示',
																msg : '该来稿单位公司无联系人！',
																buttons : Ext.Msg.OK,
																icon : Ext.Msg.INFO,
																width : 200
															});
								    		 	}
								    		 }
							    		 }
								}, {
									xtype : 'combo',
									id:'manuscriptCategory',
									store : manuscriptCategoryList,
									fieldLabel : '稿件类型',
									editable : false,
									forceSelection : true,
									typeAhead : true,
									value:manuscriptCategory.manuscriptCategoryName,
									mode : 'local',
									triggerAction : 'all',
									hiddenName : 'manuscriptCategoryId',
									valueField : 'manuscriptCategoryId',
									displayField : 'manuscriptCategoryName',
									validator:function(){
										return true;
									} ,
									itemCls : 'form_text',
							    	 listeners:{
										'valid':function(){
											if(Ext.getCmp('manuscriptCategory').getValue()==manuscriptCategory.manuscriptCategoryName){
													Ext.getCmp('manuscriptCategory').hiddenField.value = manuscriptCategory.manuscriptCategoryId;
												}
											},
							    		 "focus":function(){
								    		 	if(manuscriptCategoryList.getTotalCount() == 0){
								    		 		Ext.Msg.show({
																title : '操作提示',
																msg : '请管理员添加稿件分类!',
																buttons : Ext.Msg.OK,
																icon : Ext.Msg.INFO,
																width : 200
															});
								    		 	}
								    		 }
							    		 }
								}, {
									xtype : 'combo',
									store : new Ext.data.SimpleStore({
												data : [['0', '普通'],
														['5', '紧急'],
														['10', '特急']],
												fields : ['value', 'text']
											}),

									hiddenName : 'manuscript.urgence',
									allowBlank : false,
									editable : false,
									fieldLabel : '紧急程度',
									emptyText : '请选择',
									mode : 'local',
									triggerAction : 'all',
									valueField : 'value',
									displayField : 'text',
									value : manuscript.urgence,
									itemCls : 'form_text'
								}, {
									xtype : 'datefield',
									name : 'plannedConsummationTime',
									editable : false,
									allowBlank : false,
									fieldLabel : '计划完成时间',
									value : formatTime(manuscript.plannedConsummationTime,"",""),
									minValue : new Date().format('Y-m-d'),
									format : 'Y-m-d',
									itemCls : 'form_text'
								},/* {
									name : 'manuscript.wordNum',
									fieldLabel : '字数',
									allowBlank:false,
									xtype:'textfield',
									value : manuscript.wordNum,
									regex:/^[1-9][0-9]{0,8}$/,
									regexText:'请输入长度小于等于9且最小值为1的合法正整数',
									itemCls:'form_text'
								}, */{
									xtype : 'textarea',
									fieldLabel : '备注',
									name : 'manuscript.remark',
									width : 426,
									maxLength: 200,
									itemCls : 'clear'
								},{
									xtype : 'hidden',
									name : 'manuscript.manuscriptId',
									value : manuscript.manuscriptId
								}],
								buttons : [{
						text : '修改',
						type : 'submit',
						handler : function() {
								if (modifyManuscriptForm.form.isValid()) {
								modifyManuscriptForm.form.doAction('submit', {
									url : 'receiver_modifyManuscript_edit.action',// 文件路径
									method : 'post',// 提交方法post或get
									params : '',
									success : function(form, action) {
											if (action.result.success) {
												Ext.Msg.show({
												title : '操作提示',
												msg : '修改成功!',
												buttons : Ext.Msg.OK,
												icon : Ext.Msg.INFO,
												width : 200
											});
											manuscript_window.hide();
											ds_receiver_manuscript.load({
														params : {
															start : 0,
															limit : 20
														}
													});
										} else {
											Ext.Msg.show({
												title : '错误提示',
												msg : action.result.errorMessage,
												buttons : Ext.Msg.OK,
												icon : Ext.Msg.ERROR,
												width : 200
											});
										}
										manuscript_window.remove(Ext.getCmp('mmf'));
									},
									failure : function() {
									if(action.result == null){
										Ext.Msg.show({
											title : '错误提示',
											msg : '数据不符合要求',
											buttons : Ext.Msg.OK,
											icon : Ext.Msg.ERROR,
											width : 200
										});
									}else{
										if(!action.result.success){
											Ext.Msg.show({
												title : '错误提示',
												msg : action.result.errorMessage,
												buttons : Ext.Msg.OK,
												icon : Ext.Msg.ERROR,
												width : 200
											});
										}
									}
									manuscript_window.remove(Ext.getCmp('mmf'));
								}
								});
							}
							
							
						}
					}, {
						text : '重置',
						handler : function() {
							modifyManuscriptForm.form.reset();
						}
					},{
			     		text : '取消',
			     		handler : function() {
							manuscript_window.hide();
							manuscript_window.remove(Ext.getCmp('mmf'));
						}
			     	}]
					})]
				}).show();

			} else {
				Ext.MessageBox.alert('查看稿件详情以编辑失败');
			}
		},
		failure : function() {
			Ext.Msg.show({
						title : '错误提示',
						msg : '修改用户信息失败!',
						buttons : Ext.Msg.OK,
						icon : Ext.Msg.ERROR,
						width : 200
					});
		}
	});
}

window.downloadManuscript = function(needParam){
	Ext.Ajax.request({
        url: 'manuscriptByReceiver_download.action',
        method: 'post',
        params: {
            manuscriptId: needParam
        },
        success: function(resp, opts){
            var respText = Ext.util.JSON.decode(resp.responseText);
        	if(respText.success){
        		if(respText.entityPaths == null || '' == respText.entityPaths){
        			Ext.Msg.show({
		                title: '错误提示',
		                msg: '没有附件!',
		                buttons: Ext.Msg.OK,
		                icon: Ext.Msg.ERROR,
		                width: 200
		            });
		            return;
        		}
        		var path = "download.action?inputPath=" + respText.entityPaths + "&refEntityId=" + needParam + "&refEntityType=Manuscript";
    			window.location.href = path;
        	}else{
        		Ext.Msg.show({
	                title: '错误提示',
	                msg: respText.errorMessage,
	                buttons: Ext.Msg.OK,
	                icon: Ext.Msg.ERROR,
	                width: 200
	            });
        	}
        },
        failure: function(){
            Ext.Msg.show({
                title: '错误提示',
                msg: '没有附件!',
                buttons: Ext.Msg.OK,
                icon: Ext.Msg.ERROR,
                width: 200
            });
        }
    });
}

var cm_receiver_manuscript = new Ext.grid.ColumnModel([
	new Ext.grid.RowNumberer(),
	{header:'稿件标题',dataIndex:'title',width:300,sortable:true,renderer:function(value, metadata, record)
		{
    	 	return "<a href = 'javascript:void(0)' onclick=javascript:showManuscript('" + record.data.manuscriptId + "')>" + escapeHTML(value) + "</a>";
		}
	},
	{header:'来稿单位',dataIndex:'contributeCompanyName',sortable:true},
	{header:'稿件分类',dataIndex:'manuscriptCategoryName',sortable:true},
	{header:'计划完成时间',dataIndex:'plannedConsummationTime',sortable:true,renderer: function change(value, metadata, record){
//	        return totime(value, metadata, record);
			return new Date(value).format("Y-m-d","","");
	    }
	},
	{header:'标识',sortable:true,renderer: function drawmark(value, metadata, record){
	        return tomark(value, metadata, record);
	    }
	},
	{header:"操作",width:120,dataIndex:'operation',renderer : function(value, metadata, record) {
		if(record.data.status != 10)
		{
			if(record.data.type == 0){
				return "<a href = 'javascript:void(0)' onclick=javascript:modifyManuscript('" + record.data.manuscriptId + "')>修改 </a>&nbsp;&nbsp;&nbsp;"
					+"<font color='#cccccc'>下载</font>"
			}else{
				return "<a href = 'javascript:void(0)' onclick=javascript:modifyManuscript('" + record.data.manuscriptId + "')>修改 </a>&nbsp;&nbsp;&nbsp;"
					+"<a href = 'javascript:void(0)' onclick=javascript:downloadManuscript('"+ record.data.manuscriptId +"')>下载</a>";
			}
		}
		else
		{
			if(record.data.type == 0){
				return "<font color='#cccccc'>修改</font>&nbsp;&nbsp;&nbsp;&nbsp;"
				+"<font color='#cccccc'>下载</font>";
			}else{
				return "<font color='#cccccc'>修改</font>&nbsp;&nbsp;&nbsp;&nbsp;"
				+"<a href = 'javascript:void(0)' onclick=javascript:downloadManuscript('"+ record.data.manuscriptId +"')>下载</a>";
			}
		}
		
	}
	}
]);

var grid_receiver_manuscript = new Ext.grid.GridPanel({
	title : '稿件管理 ',
	loadMask : {msg : '数据加载中...'},
	ds:ds_receiver_manuscript,
	store:ds_receiver_manuscript,
	region : 'center',
	autoScroll: true,
	cm:cm_receiver_manuscript,
	autoExpandColumn : 6,
	bbar : new Ext.PagingToolbar({
		pageSize : 20,
		store : ds_receiver_manuscript,
		displayInfo : true,
		beforePageText:'第',
		afterPageText:'页-共{0}页',
		displayMsg : '显示{0} - {1} 条  共 {2} 条',
		emptyMsg : "没有记录"
	})
});

ds_receiver_manuscript.load({params:{start:0,limit:20}});

var l_receiver_manuscript = {
	id : 'receiver-manuscript',
	border : false,
	layout : 'border',
	items : [grid_receiver_manuscript]
};

Ext.getCmp('content-panel').add(l_receiver_manuscript);
Ext.getCmp('content-panel').layout.setActiveItem('receiver-manuscript');